var fs = require('fs');
var config = require('../../../config.json');
var zip = require('../../../common/zip.js');
var path = require('path');
var request = require('request');
var readline = require('readline');
var waterfall = require('async-waterfall');
var decompress = require('decompress');
var uuid = require('uuid');

var workspace_dirs = {
    Conf: "conf",
    Source: "source",
    Target: "target",
    Frontend: "frontend",
    Block: "block",
    Page: "page",
    Backend: "backend",
    Core: "core",
    Core_Node: "node",
    Core_Java: "java",
    Products: "products",
    Runtime: "runtime",
    Runtime_Node: "node",
    Runtime_Java: "java",
    goods_temp: "goods",
    Nectar_Plugin:"nectar_plugin",
};
exports.workspace_dirs = workspace_dirs;
var getTargetDirs = function () {
    var dirs = [];
    dirs.push(workspace_dirs.Target);
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Frontend));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Frontend, workspace_dirs.Block));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Frontend, workspace_dirs.Page));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Backend));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Backend, "dev"));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Backend, "prod"));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Core));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Core, workspace_dirs.Core_Node));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Core, workspace_dirs.Core_Java));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Core, workspace_dirs.Core_Java, "bundles"));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Products));
    dirs.push(path.join(workspace_dirs.Target, workspace_dirs.Nectar_Plugin));
    return dirs;
}

exports.getTargetDirs = getTargetDirs;

exports.getDirs = function () {
    var dirs = [];
    dirs.push(workspace_dirs.Conf);
    dirs.push(workspace_dirs.Source);
    dirs.push(workspace_dirs.Runtime);
    dirs.push(path.join(workspace_dirs.Runtime, workspace_dirs.Runtime_Java));
    dirs.push(path.join(workspace_dirs.Runtime, workspace_dirs.Runtime_Node));
    //dirs.join(getTargetDirs());
    var arr = getTargetDirs();
    return dirs.concat(arr);
}